// pages/index/comps/advPop/advPop.js
const common = require('../../../../utils/util.js')
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        showAdv: Boolean,
        popImg: Object
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /**
     * 组件的方法列表
     */
    methods: {
        // addBuyNum: function(){
        //   common.post('Activity/add_buy_num ',{}).then(function (res) {
        //     console.log(res)
        //   }).catch(function (e) { })
        // },
        closeAdv: function() {
            this.triggerEvent('closeAdv')
        },
        myCatchTouch: function() {
            return
        },
        goShopkeeperGifts: function() {
            this.triggerEvent('closeAdv')
            wx.navigateTo({
                url: '/pages/goods/shopKeeperGifts/shopKeeperGifts'
            })
        },
        goWorker: function() {
            this.triggerEvent('closeAdv')
            wx.navigateTo({
                url: '/pages/zeroBuy/index/index'
            })
        },
        formGo: function(e) {
            this.triggerEvent('closeAdv')
            if (wx.getStorageSync('token')) {
                let data = {
                    form_id: e.detail.formId
                }
                common.post('User/up_form_id', data).then(function(res) {
                    console.log(res)
                }).catch(function(e) {})
            }
            if (e.currentTarget.dataset.link) {
                wx.navigateTo({
                    url: e.currentTarget.dataset.link
                })
            }
        },
        formGoTo: function(e) {
            let data = {
                form_id: e.detail.formId
            }
            if (wx.getStorageSync('token')) {
                common.post('User/up_form_id', data).then(function(res) {
                    console.log(res)
                }).catch(function(e) {})
            }
            this.triggerEvent('closeAdv')
        }
    }
})